package com.study.anno;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;

/**
 * @author zhuzi
 * 2024/9/26 10:44
 */

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ApiRateLimit {
    /**
     * 每秒钟生成令牌的速率
     *
     * @return
     */
    double qps() default 1;

    /**
     * 尝试获取令牌的超时时间
     *
     * @return
     */
    long timeout() default 0;

    TimeUnit timeUnit() default TimeUnit.SECONDS;
}
